<?php
require_once("/var/www/html/new/com.inc.php");
$ac=$GLOBALS['_ac'];
$pw=$GLOBALS['_pw'];
$s = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));
$ordern='360113';
require("/var/www/html/new/d/class/OrderRecord.php");
$or=new OrderRecord($ordern,$s);
$orders=$or->info();
$mainOrder=$orders['mainOrder'];
$mid=(string)$mainOrder->UUmid;
$aid=(string)$mainOrder->UUaid;

/***产品多级销售分润*****/
$str="select * from uu_order_fx_details where orderid='$ordern'";
$GLOBALS['le']->query($str);
$lirun=$GLOBALS['le']->fetch_assoc();
if($lirun['aids_money']){
    $aids_money=unserialize($lirun['aids_money']);
    $opID=0;
    foreach($aids_money as $row){
        $fid=$row[0];
        $dmode=($row[2]==0)?1:0;//0减少,1增加和接口相反
        $Mmoney=$row[3];
        if($row[1]==0){//信用额度
            $action=1;
            echo "PFT_Member_Fund_Modify($fid,$opID,$Mmoney,$action,$dmode,{$row[4]},0,2,$ordern)";
            $s->PFT_Member_Fund_Modify($fid,$opID,$Mmoney,$action,$dmode,$row[4],0,2,$ordern);
        }else{//资金
            $action=0;
            echo "PFT_Member_Fund_Modify($fid,$opID,$Mmoney,$action,$dmode,NULL,0,0,$ordern)";
            $s->PFT_Member_Fund_Modify($fid,$opID,$Mmoney,$action,$dmode,NULL,0,0,$ordern);
        }
    }
}
// exit;
/*重发短信*/
// $s->reSend_SMS_Global_PL($ordern,$aid,$mid);//最后重发短信

/*记录分销商分润流向*/
// $royalty_parameters=explode("|",$royalty_parameters);
// $i=0;
// foreach($royalty_parameters as $row){
    // $about=explode("^",$row);
    // $money=$about[1]*100;
    // $total_fee*=100;
    // $ali_account=$about[0];
    // $orderid=$ordern;
    // $fid=($i++==0)?$aid:$mid;
    // $str="insert pft_member_alipay set fid=$fid,orderid='$orderid',total_fee=$total_fee,money=$money,ali_account='$ali_account',rectime=now()";
    // $GLOBALS['le']->query($str);
// }
    
/*只更新订单支付状态*/
// include("/var/www/html/alipay/order_pay.php");
echo "success";		//请不要修改或删除
?>